package com.tencent.qf.systembiz.controller;

import com.alibaba.fastjson.JSON;
import com.tencent.qf.common.pojo.HttpResult;
import com.tencent.qf.common.pojo.OperateLogVO;
import com.tencent.qf.mybatis.pojo.PageRequest;
import com.tencent.qf.mybatis.pojo.PageResult;
import com.tencent.qf.systembiz.controller.request.OperateLogListReqVo;
import com.tencent.qf.systembiz.service.OperateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.tencent.qf.common.pojo.HttpResult.success;

/**
 * Copyright (C) 2022 Limited, a Tencent company. All rights reserved.
 *
 * @author p_htaozhou@tencent.com
 * @create: 2022/9/15 20:19
 */
@RestController
@RequestMapping("/system/operateLog")
@Api(tags = "操作日志管理")
@Slf4j
public class OperateLogController {

    @Resource
    private OperateLogService operateLogService;

    @PostMapping("/getOperateLogList")
    @ApiOperation("获取操作日志列表")
    public HttpResult<PageResult<OperateLogVO>> getOperateLogList(@RequestBody @Valid PageRequest<OperateLogListReqVo> request) {
        log.info("OperateLogController.getOperateLogList request:{}", JSON.toJSONString(request));
        return success(operateLogService.getOperateLogList(request));
    }
}
